﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Bll;
using Model;
using System.Security.Cryptography;

namespace 财会系
{
    public partial class login : System.Web.UI.Page
    {
        BllAdmin b = new BllAdmin();

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSmt_Click(object sender, EventArgs e)
        {
            ModelAdmin m = new ModelAdmin();
            m.Acc = txtAcc.Text.Trim();
            m.Pwd = txtPwd.Text.Trim();

            if (b.Login(m))
            {                 
                Session["Admin"] = txtAcc.Text.Trim();
                Session["Grade"] = b.Admin_Grade(m);
                Session["Name"] = b.Admin_Name(m);
                Session["Type"] = b.Admin_Type(m);
                Response.Redirect("./ckx.aspx");
            }
            else
            {
                Response.Write("<script>confirm('登陆失败!')?window.location='./login.aspx':window.location='./login.aspx';</script>");
                txtAcc.Text = "";
                txtPwd.Text = "";
            }
        }

    }
}